<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<%
        String basePath = "http://" + request.getLocalAddr() + ":" + request.getLocalPort() + request.getContextPath();
%>
<title>${promptInfo.totalDescInfo}</title>
<head>
<script type="text/javascript">
$(document).ready(function(){	
    var jdata = {
   	    globalParam:$("#actionForm").formSerialize(),
   		//树是否全部展开true：展开,false:合并
   		isOpen:'true',
   	    //first,last
       	checkbox:{name:'全选',type:'first',width:'10%'},
       	shortcut:{
       		name:'操作',
   	    	url:'decorateForwardAction.action',
   	    	width:'30%',
   	    	event:[
       			{
           			operate:'modify',name:'${pmsIndex.sys_role_modify.name}',
           			disabled:'false',isvalid:'${!empty pmsIndex.sys_role_modify}',
           			param:'code=${pmsIndex.sys_role_modify.code}'
               	},
       			{
           			operate:'del',name:'${pmsIndex.sys_role_delete.name}',
           			disabled:'true',isvalid:'${!empty pmsIndex.sys_role_delete}',
           			param:'code=${pmsIndex.sys_role_delete.code}'
               	},
       			{
           			operate:'detail',name:'${pmsIndex.sys_role_detail.name}',
           			disabled:'false',isvalid:'${!empty pmsIndex.sys_role_detail}',
           			param:'code=${pmsIndex.sys_role_detail.code}'
               	},
       			{
           			operate:'grant',name:'${pmsIndex.sys_role_grant.name}',
           			disabled:'false',isvalid:'${!empty pmsIndex.sys_role_grant}',
           			param:'code=${pmsIndex.sys_role_grant.code}'
               	},
       			{
           			operate:'grant',name:'${pmsIndex.sys_role_node_bind.name}',
           			disabled:'false',isvalid:'${!empty pmsIndex.sys_role_node_bind}',
           			param:'code=${pmsIndex.sys_role_node_bind.code}',
           			icon:'images/common/307.gif'
               	}
   	        ]
   	    },
   		//列表树结构显示字段是否有复选框 
   		treeCheckbox: 'false',	
   		//父亲节点是否可操作（true：可操作 false：不可操作）
   		isParentNodeOpt:'true',
       	//列表要显示的列（在json中对应的key）
   		tableShowColumn: ['roleName','roleDesc'],
   		//列表头显示名称
   		tableColumnName:   ['角色名称','角色说明'],
   		//列表头宽度
   		tableColumnWidth:   ['25%','15%'],
   		//可以作为主键的类，在页面传送的过程中为paramMap.key{1}(主键个数值)=value的形式
   		//多个主键的时候为["orgID","orgCode"]:paramMap.key1=value&paramMap.key2=value
   		primkeyColumn:["roleID","roleParentID","roleRelation","roleName"],
   		//要增加链接的列，可以为多个
   		tableLinkColumn:[],
   		//要进行树型显示的列，支持一列
   		treeShowColumn:'roleName',
   		//树型菜单，起始根值
   		treeNodeStartValue:'0',
   		//属性菜单子列
   		treeChildColumn:'roleID',
   		//属性菜单父列
   		treeParendColumn:'roleParentID',
       	ajax:{
   			//ajax请求url
   			url:'ajaxAction.action', 
   			//ajax请求参数
   			data:'code=${code}'
   		}
    };
	var joption = {
	};
	$('#gridTree').gridTreeTB(jdata,joption);	

	$('#delete_role').screenTB({
		windowDocument:window.parent.document,
		width:'250',
		height:'130',
		content:'测试内容',
		contentAlign:'center',
		contentValign:'middle',
		title:'系统提示信息',
		buttonValueYes:'确定',	
		buttonValueNo:'取消',	
		dialogType:'alert',
		iframeSrc:''				
		},{
		clickEvent:function(data){
			if ($("#gridTree tbody input[type='checkbox']:checked").size() == 0){
				data = $.extend(data,{content:'请选择您要删除的角色！'})
				return false;
			}
			else{
				var roleID="";
				$("#gridTree tbody input[type='checkbox']:checked").each(function(i){
					var cval = $(this).val();
					var index = $(this).val().indexOf("#");
					if (i ==0){
						roleID =$(this).val().substring(0,index);
					}
					else{
						roleID+= "," + $(this).val().substring(0,index);
					}
				})
				window.location.href = "decorateForwardAction.action?code=${pmsIndex.sys_role_delete.code}&paramMap.roleID="+roleID;
				return true;
			}
		}
	});
});
</script>
</head>
<body>
 <form name="actionForm" method="post" action="operateAction.action" id="actionForm">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableC">
   <tr>
    <td class="tableCleft">&nbsp;</td>
    <td class="tableCcenter" align="right">
	    <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="SkyTableLine">
          <tr>
            <td class="SkyTDLine" align="right" style="background:#9CC7FF;height:22;" >
                 <s:if test="pmsIndex.sys_role_create">
  				<a href="decorateForwardAction.action?code=${pmsIndex.sys_role_create.code}"><img src="<%=request.getContextPath()%>/${pmsIndex.sys_role_create.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.sys_role_create.name}</a>
				</s:if>
				<s:if test="pmsIndex.sys_role_delete">
					<a id="delete_role" href="#"><img src="<%=request.getContextPath()%>/${pmsIndex.sys_role_delete.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.sys_role_delete.name}</a>
				</s:if>
		     </td>
            </tr>
          </table>                         
       </td>
      <td class="tableCright">&nbsp;</td>
    </tr>
    <tr>
       <td class="tableCleft">&nbsp;</td>
       <td class="tableCcenter">
            <table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" class="SkyTDLine">
                <tr>
                    <td valign="top" colspan="6" id="gridTree" class="MeNewTDLine"></td>
                </tr>
            </table>
        </td>
        <td class="tableCright">&nbsp;</td>
    </tr>
</table>
</form>
</body>
</HTML>
